<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>

   <script>

    function Persion(name,age,gender){
        this.name=name;
        this.age=age;
        this.gender=gender;
        
        // this.sayName = fun;
    }

    //将sayName方法在全局作用域中定义
    Persion.prototype.sayName=function(){
            alert("Hello大家好，我是："+this.name);
        }


    var per1 = new Persion("张三",18,"男");
    var per2 = new Persion("李四",20,"女");

    console.log(per1.sayName());
   </script>
</head>
<body>
    
</body>
</html>